<!DOCTYPE html>
<!-- saved from url=(0016)http://localhost -->
<html>
  <head>
    <meta charset="utf-8"/>
    <meta content="IE=edge" http-equiv="X-UA-Compatible"/>
    <title>电路电子学Index</title>
    <style>
        body{
            margin: 0;
        }
        #content-info{
            width: auto;
            margin: 0 auto;
            text-align: center;
        }
        #author-info{
            white-space: nowrap;
            text-overflow: ellipsis;
            overflow: hidden;
        }
        #title{
            text-overflow: ellipsis;
            white-space: nowrap;
            overflow: hidden;
            padding-top: 10px;
            margin-bottom: 2px;
            font-size: 34px;
            color: #505050;
        }
        .text{
            white-space:nowrap;
            text-overflow: ellipsis;
            display: inline-block;
            margin-right: 20px;
            margin-bottom: 2px;
            font-size: 20px;
            color: #8c8c8c;
        }
        #navBar{
            width: auto;
            height: auto;
            position: fixed;
            right:0;
            bottom: 0;
            background-color: #f0f3f4;
            overflow-y: auto;
            text-align: center;
        }
        #svg-container{
            width: 100%;
            overflow-x: scroll;
            min-width: 0px;
            margin: 0 10px;
            overflow: visible;
            position: relative;
        }
        #nav-thumbs{
            overflow-y: scroll;
            padding: 0 5px;
        }
        .nav-thumb{
            position: relative;
            margin: 10px auto;
        }
        .nav-thumb >p{
            text-align: center;
            font-size: 12px;
            margin: 4px 0 0 0;
        }
        .nav-thumb >div{
            position: relative;
            display: inline-block;
            border: 1px solid #c6cfd5;
        }
        .nav-thumb img{
            display: block;
        }
        #main-content{
            bottom: 0;
            left: 0;
            right: 0;
            background-color: #d0cfd8;
            display: flex;
            height: auto;
            flex-flow: row wrap;
            text-align:center;
        }
        #svg-container >svg{
            overflow: visible;
            display: block;
            margin:5px auto;
            margin-bottom: 5px;
        }
        #copyright{
            bottom: 0;
            left: 50%;
            margin: 5px auto;
            font-size: 16px;
            color: #515151;
        }
        #copyright >a{
            text-decoration: none;
            color: #77C;
        }
        .number{
            position: absolute;
            top:0;
            left:0;
            border-top:22px solid #08a1ef;
            border-right: 22px solid transparent;
        }
        .pagenum{
            font-size: 12px;
            color: #fff;
            position: absolute;
            top: -23px;
            left: 2px;
        }
            #navBar::-webkit-scrollbar{
            width: 8px;
            background-color: #f5f5f5;
        }
            #navBar::-webkit-scrollbar-track{
            -webkit-box-shadow: inset 0 0 4px rgba(0,0,0,.3);
            border-radius: 8px;
            background-color: #fff;
        }
            #navBar::-webkit-scrollbar-thumb{
            border-radius: 8px;
            -webkit-box-shadow: inset 0 0 4px rgba(0,0,0,.3);
            background-color: #6b6b70;
        }
        #navBar::-webkit-scrollbar-thumb:hover{
            background-color: #4a4a4f;
        }
</style>
  </head>
  <body>
    <div id="main-area">
      <div id="content-info">
        <div id="content-info">
          <div id="title">电路电子学Index</div>
        </div>
        <div id="author-info">
          <div class="text" id="author-name">RUWU</div>
          <div class="text" id="share-time">2024-03-05</div>
        </div>
      </div>
      <div id="main-content">
        <div id="svg-container"><svg width="1603" ed:hSpacing="30" preserveAspectRadio="xMinYMin meet" xmlns="http://www.w3.org/2000/svg" height="671" xmlns:ev="http://www.w3.org/2001/xml-events" id="page0" viewBox="0 0 1603 671" xmlns:xlink="http://www.w3.org/1999/xlink" ed:vSpacing="30" xmlns:ed="https://www.edrawsoft.com/xml/2017/SVGExtensions/" ed:name="画布 1">
    <style type="text/css"><![CDATA[
g[ed\:togtopicid],g[ed\:hyperlink],g[ed\:comment],g[ed\:note] {cursor:pointer;}
g[id] {-moz-user-select: none;-ms-user-select: none;user-select: none;}
svg text::selection,svg tspan::selection{background-color: #4285f4;color: #ffffff;fill: #ffffff;}
.st15 {fill:#454545;font-family:Times New Roman;font-size:23pt;font-weight:bold}
.st17 {fill:#454545;font-family:华文楷体;font-size:13pt}
.st16 {fill:#454545;font-family:华文楷体;font-size:15pt}
]]></style>
    <defs/>
    <rect width="1603" height="671" x="0" y="0" fill="#fbfcfb"/>
    <path ed:tosuperid="122" transform="matrix(1,0,0,1,928.5,325.88)" id="123" ed:parentid="101" d="M30.8,-54.7C29.5,-53.4,29.5,-51.7,30.5,-50.8C31.5,-49.8,33.2,-49.9,34.4,-51.2C36,-52.9,37.5,-54.6,39.1,-56.2C40.7,-57.9,42.4,-59.4,44.1,-60.9C45.8,-62.5,47.6,-63.9,49.4,-65.3C51.2,-66.7,53.1,-68,55,-69.2C56.9,-70.5,58.9,-71.6,61,-72.7C63,-73.8,65.1,-74.7,67.2,-75.6C69.3,-76.5,71.4,-77.3,73.7,-77.9C75.9,-78.6,78.1,-79.2,80.3,-79.7C82.5,-80.2,84.6,-80.5,87.2,-80.8C89.7,-81.1,92.6,-81.3,94.1,-81.4C95.6,-81.5,95.6,-81.5,95.6,-81.5C95.8,-81.2,96.2,-81.7,96.2,-82C96.2,-82.2,95.8,-82.2,95.6,-82.5C95.6,-82.5,95.6,-82.5,94.1,-82.5C92.6,-82.5,89.6,-82.4,87,-82.3C84.5,-82.1,82.3,-81.9,80,-81.5C77.7,-81.2,75.4,-80.7,73,-80.1C70.7,-79.5,68.5,-78.9,66.2,-78.1C64,-77.3,61.8,-76.4,59.6,-75.4C57.4,-74.4,55.3,-73.4,53.3,-72.2C51.2,-71,49.2,-69.7,47.2,-68.4C45.2,-67.1,43.3,-65.7,41.4,-64.2C39.5,-62.7,37.7,-61.2,36,-59.6C34.2,-58,32.5,-56.3,30.8,-54.7z" stroke="#ff7575" stroke-linejoin="round" fill="#ff7575" stroke-linecap="round"/>
    <path ed:tosuperid="139" transform="matrix(1,0,0,1,737.3,305.96)" id="140" ed:parentid="101" d="M-26.4,-58C-25.4,-56.5,-23.7,-56.2,-22.6,-57C-21.5,-57.7,-21.2,-59.4,-22.2,-60.8C-23.6,-62.7,-25,-64.7,-26.5,-66.5C-28,-68.4,-29.5,-70.2,-31,-72C-32.6,-73.8,-34.2,-75.5,-35.9,-77.2C-37.5,-78.9,-39.3,-80.6,-41,-82.1C-42.8,-83.7,-44.7,-85.2,-46.6,-86.7C-48.5,-88.1,-50.4,-89.5,-52.4,-90.8C-54.4,-92,-56.5,-93.2,-58.6,-94.3C-60.7,-95.4,-62.9,-96.3,-65.1,-97.2C-67.3,-98.1,-69.6,-98.8,-71.8,-99.5C-74.1,-100.1,-76.5,-100.7,-78.8,-101.1C-81,-101.5,-83.2,-101.8,-85.8,-102.1C-88.3,-102.3,-91.1,-102.4,-92.8,-102.4C-94.5,-102.4,-95,-102.4,-95.6,-102.4C-96,-102.4,-96.2,-102.2,-96.2,-101.9C-96.2,-101.6,-96,-101.4,-95.6,-101.4C-95.1,-101.4,-94.5,-101.4,-92.8,-101.3C-91.2,-101.2,-88.4,-100.9,-85.9,-100.6C-83.5,-100.3,-81.3,-99.9,-79.1,-99.4C-76.9,-98.8,-74.7,-98.2,-72.5,-97.5C-70.3,-96.8,-68.1,-95.9,-66,-95C-64,-94,-61.9,-93,-59.9,-91.9C-57.9,-90.7,-56,-89.5,-54.1,-88.2C-52.2,-86.9,-50.4,-85.5,-48.7,-84C-46.9,-82.6,-45.2,-81,-43.6,-79.4C-41.9,-77.8,-40.3,-76.2,-38.8,-74.5C-37.3,-72.8,-35.8,-71,-34.4,-69.2C-33,-67.4,-31.6,-65.6,-30.2,-63.7C-28.9,-61.8,-27.6,-59.9,-26.4,-58z" stroke="#6cc9e5" stroke-linejoin="round" fill="#6cc9e5" stroke-linecap="round"/>
    <path ed:tosuperid="145" transform="matrix(1,0,0,1,737.3,425.56)" id="146" ed:parentid="101" d="M-32,10.8C-30.2,10.4,-29.4,9,-29.7,7.6C-30,6.3,-31.5,5.5,-33.2,6C-35.5,6.6,-37.7,7.3,-39.9,7.9C-42.2,8.5,-44.4,9.1,-46.7,9.7C-48.9,10.3,-51.2,10.8,-53.4,11.4C-55.7,11.9,-57.9,12.4,-60.2,12.9C-62.5,13.4,-64.8,13.8,-67,14.2C-69.3,14.6,-71.6,15,-73.9,15.3C-76.2,15.6,-78.5,15.9,-80.8,16.2C-83.1,16.4,-85.3,16.7,-87.8,16.8C-90.2,17,-92.9,17.1,-95.6,17.2C-96,17.2,-96.2,17.5,-96.2,17.7C-96.2,18,-96,18.2,-95.6,18.3C-92.9,18.3,-90.2,18.3,-87.7,18.3C-85.2,18.3,-83,18.2,-80.7,18.1C-78.4,18,-76,17.9,-73.6,17.7C-71.3,17.5,-69,17.2,-66.6,17C-64.3,16.7,-62,16.4,-59.6,16.1C-57.3,15.7,-55,15.4,-52.7,15C-50.4,14.6,-48.1,14.2,-45.7,13.7C-43.4,13.3,-41.1,12.8,-38.8,12.3C-36.5,11.8,-34.3,11.3,-32,10.8z" stroke="#f1a3dc" stroke-linejoin="round" fill="#f1a3dc" stroke-linecap="round"/>
    <path ed:tosuperid="147" transform="matrix(1,0,0,1,928.5,489.79)" id="148" ed:parentid="101" d="M34.4,51.2C33.2,49.9,31.5,49.8,30.5,50.8C29.5,51.7,29.5,53.4,30.8,54.7C32.5,56.3,34.2,58,36,59.6C37.7,61.2,39.5,62.7,41.4,64.2C43.3,65.7,45.2,67.1,47.2,68.4C49.2,69.7,51.2,71,53.3,72.2C55.3,73.4,57.4,74.4,59.6,75.4C61.8,76.4,64,77.3,66.2,78.1C68.5,78.9,70.7,79.5,73,80.1C75.4,80.7,77.7,81.2,80,81.5C82.3,81.9,84.5,82.1,87,82.3C89.6,82.4,92.6,82.5,94.1,82.5C95.6,82.5,95.6,82.5,95.6,82.5C95.8,82.2,96.2,82.2,96.2,82C96.2,81.7,95.8,81.2,95.6,81.5C95.6,81.5,95.6,81.5,94.1,81.4C92.6,81.3,89.7,81.1,87.2,80.8C84.6,80.5,82.5,80.2,80.3,79.7C78.1,79.2,75.9,78.6,73.7,77.9C71.4,77.3,69.3,76.5,67.2,75.6C65.1,74.7,63,73.8,61,72.7C58.9,71.6,56.9,70.5,55,69.2C53.1,68,51.2,66.7,49.4,65.3C47.6,63.9,45.8,62.5,44.1,60.9C42.4,59.4,40.7,57.9,39.1,56.2C37.5,54.6,36,52.9,34.4,51.2z" stroke="#5fb7f1" stroke-linejoin="round" fill="#5fb7f1" stroke-linecap="round"/>
    <path ed:tosuperid="246" transform="matrix(1,0,0,1,737.3,509.71)" id="247" ed:parentid="101" d="M-22.2,60.8C-21.2,59.4,-21.5,57.7,-22.6,57C-23.7,56.2,-25.4,56.5,-26.4,58C-27.6,59.9,-28.9,61.8,-30.2,63.7C-31.6,65.6,-33,67.4,-34.4,69.2C-35.8,71,-37.3,72.8,-38.8,74.5C-40.3,76.2,-41.9,77.8,-43.6,79.4C-45.2,81,-46.9,82.6,-48.7,84C-50.4,85.5,-52.2,86.9,-54.1,88.2C-56,89.5,-57.9,90.7,-59.9,91.9C-61.9,93,-64,94,-66,95C-68.1,95.9,-70.3,96.8,-72.5,97.5C-74.7,98.2,-76.9,98.8,-79.1,99.4C-81.3,99.9,-83.5,100.3,-85.9,100.6C-88.4,100.9,-91.2,101.2,-92.8,101.3C-94.5,101.4,-95.1,101.4,-95.6,101.4C-96,101.4,-96.2,101.6,-96.2,101.9C-96.2,102.2,-96,102.4,-95.6,102.4C-95,102.4,-94.5,102.4,-92.8,102.4C-91.1,102.4,-88.3,102.3,-85.8,102.1C-83.2,101.8,-81,101.5,-78.8,101.1C-76.5,100.7,-74.1,100.1,-71.8,99.5C-69.6,98.8,-67.3,98.1,-65.1,97.2C-62.9,96.3,-60.7,95.4,-58.6,94.3C-56.5,93.2,-54.4,92,-52.4,90.8C-50.4,89.5,-48.5,88.1,-46.6,86.7C-44.7,85.2,-42.8,83.7,-41,82.1C-39.3,80.6,-37.5,78.9,-35.9,77.2C-34.2,75.5,-32.6,73.8,-31,72C-29.5,70.2,-28,68.4,-26.5,66.5C-25,64.7,-23.6,62.7,-22.2,60.8z" stroke="#ffcd55" stroke-linejoin="round" fill="#ffcd55" stroke-linecap="round"/>
    <path ed:tosuperid="190" transform="matrix(1,0,0,1,1238.65,146.44)" id="195" ed:parentid="122" d="M-17.5,97.5C7,97.5,-17.5,-97.5,17.5,-97.5" stroke="#ff7575" stroke-width="2" stroke-linejoin="round" fill="none" stroke-linecap="round"/>
    <path ed:tosuperid="196" transform="matrix(1,0,0,1,1238.65,164.16)" id="197" ed:parentid="122" d="M-17.5,79.8C7,79.8,-17.5,-79.8,17.5,-79.8" stroke="#ff7575" stroke-width="2" stroke-linejoin="round" fill="none" stroke-linecap="round"/>
    <path ed:tosuperid="198" transform="matrix(1,0,0,1,1238.65,181.89)" id="199" ed:parentid="122" d="M-17.5,62C6.8,62,-17.1,-62,17.5,-62" stroke="#ff7575" stroke-width="2" stroke-linejoin="round" fill="none" stroke-linecap="round"/>
    <path ed:tosuperid="200" transform="matrix(1,0,0,1,1238.65,199.61)" id="201" ed:parentid="122" d="M-17.5,44.3C5.3,44.3,-13.5,-44.3,17.5,-44.3" stroke="#ff7575" stroke-width="2" stroke-linejoin="round" fill="none" stroke-linecap="round"/>
    <path ed:tosuperid="202" transform="matrix(1,0,0,1,1238.65,217.34)" id="203" ed:parentid="122" d="M-17.5,26.6C2.4,26.6,-6.8,-26.6,17.5,-26.6" stroke="#ff7575" stroke-width="2" stroke-linejoin="round" fill="none" stroke-linecap="round"/>
    <path ed:tosuperid="204" transform="matrix(1,0,0,1,1238.65,235.06)" id="205" ed:parentid="122" d="M-17.5,8.9C-1.4,8.9,2.2,-8.9,17.5,-8.9" stroke="#ff7575" stroke-width="2" stroke-linejoin="round" fill="none" stroke-linecap="round"/>
    <path ed:tosuperid="206" transform="matrix(1,0,0,1,1238.65,252.79)" id="207" ed:parentid="122" d="M-17.5,-8.9C-1.4,-8.9,2.2,8.9,17.5,8.9" stroke="#ff7575" stroke-width="2" stroke-linejoin="round" fill="none" stroke-linecap="round"/>
    <path ed:tosuperid="208" transform="matrix(1,0,0,1,1238.65,270.51)" id="209" ed:parentid="122" d="M-17.5,-26.6C2.4,-26.6,-6.8,26.6,17.5,26.6" stroke="#ff7575" stroke-width="2" stroke-linejoin="round" fill="none" stroke-linecap="round"/>
    <path ed:tosuperid="210" transform="matrix(1,0,0,1,1238.65,288.24)" id="211" ed:parentid="122" d="M-17.5,-44.3C5.3,-44.3,-13.5,44.3,17.5,44.3" stroke="#ff7575" stroke-width="2" stroke-linejoin="round" fill="none" stroke-linecap="round"/>
    <path ed:tosuperid="212" transform="matrix(1,0,0,1,1238.65,305.96)" id="213" ed:parentid="122" d="M-17.5,-62C6.8,-62,-17.1,62,17.5,62" stroke="#ff7575" stroke-width="2" stroke-linejoin="round" fill="none" stroke-linecap="round"/>
    <path ed:tosuperid="214" transform="matrix(1,0,0,1,1238.65,323.69)" id="215" ed:parentid="122" d="M-17.5,-79.8C7,-79.8,-17.5,79.8,17.5,79.8" stroke="#ff7575" stroke-width="2" stroke-linejoin="round" fill="none" stroke-linecap="round"/>
    <path ed:tosuperid="216" transform="matrix(1,0,0,1,1238.65,341.41)" id="217" ed:parentid="122" d="M-17.5,-97.5C7,-97.5,-17.5,97.5,17.5,97.5" stroke="#ff7575" stroke-width="2" stroke-linejoin="round" fill="none" stroke-linecap="round"/>
    <path ed:tosuperid="218" transform="matrix(1,0,0,1,1298.65,536.3)" id="219" ed:parentid="147" d="M-17.5,35.5C4,35.5,-10.5,-35.5,17.5,-35.5" stroke="#5fb7f1" stroke-width="2" stroke-linejoin="round" fill="none" stroke-linecap="round"/>
    <path ed:tosuperid="220" transform="matrix(1,0,0,1,1298.65,554.03)" id="221" ed:parentid="147" d="M-17.5,17.7C0.6,17.7,-2.5,-17.7,17.5,-17.7" stroke="#5fb7f1" stroke-width="2" stroke-linejoin="round" fill="none" stroke-linecap="round"/>
    <path ed:tosuperid="222" transform="matrix(1,0,0,1,1298.65,571.75)" id="223" ed:parentid="147" d="M-17.5,0C-3.5,0,7,0,17.5,0" stroke="#5fb7f1" stroke-width="2" stroke-linejoin="round" fill="none" stroke-linecap="round"/>
    <path ed:tosuperid="224" transform="matrix(1,0,0,1,1298.65,589.48)" id="225" ed:parentid="147" d="M-17.5,-17.7C0.6,-17.7,-2.5,17.7,17.5,17.7" stroke="#5fb7f1" stroke-width="2" stroke-linejoin="round" fill="none" stroke-linecap="round"/>
    <path ed:tosuperid="226" transform="matrix(1,0,0,1,1298.65,607.2)" id="227" ed:parentid="147" d="M-17.5,-35.5C4,-35.5,-10.5,35.5,17.5,35.5" stroke="#5fb7f1" stroke-width="2" stroke-linejoin="round" fill="none" stroke-linecap="round"/>
    <path ed:tosuperid="228" transform="matrix(1,0,0,1,427.15,150.91)" id="229" ed:parentid="139" d="M17.5,53.2C-6.3,53.2,15.8,-53.2,-17.5,-53.2" stroke="#6cc9e5" stroke-width="2" stroke-linejoin="round" fill="none" stroke-linecap="round"/>
    <path ed:tosuperid="230" transform="matrix(1,0,0,1,427.15,168.64)" id="231" ed:parentid="139" d="M17.5,35.5C-4,35.5,10.5,-35.4,-17.5,-35.4" stroke="#6cc9e5" stroke-width="2" stroke-linejoin="round" fill="none" stroke-linecap="round"/>
    <path ed:tosuperid="232" transform="matrix(1,0,0,1,427.15,186.36)" id="233" ed:parentid="139" d="M17.5,17.7C-0.6,17.7,2.5,-17.7,-17.5,-17.7" stroke="#6cc9e5" stroke-width="2" stroke-linejoin="round" fill="none" stroke-linecap="round"/>
    <path ed:tosuperid="234" transform="matrix(1,0,0,1,427.15,204.09)" id="239" ed:parentid="139" d="M17.5,0C3.5,0,-7,-0,-17.5,-0" stroke="#6cc9e5" stroke-width="2" stroke-linejoin="round" fill="none" stroke-linecap="round"/>
    <path ed:tosuperid="240" transform="matrix(1,0,0,1,427.15,221.81)" id="241" ed:parentid="139" d="M17.5,-17.7C-0.6,-17.7,2.5,17.7,-17.5,17.7" stroke="#6cc9e5" stroke-width="2" stroke-linejoin="round" fill="none" stroke-linecap="round"/>
    <path ed:tosuperid="242" transform="matrix(1,0,0,1,427.15,239.54)" id="243" ed:parentid="139" d="M17.5,-35.4C-4,-35.4,10.5,35.4,-17.5,35.4" stroke="#6cc9e5" stroke-width="2" stroke-linejoin="round" fill="none" stroke-linecap="round"/>
    <path ed:tosuperid="244" transform="matrix(1,0,0,1,427.15,257.26)" id="245" ed:parentid="139" d="M17.5,-53.2C-6.3,-53.2,15.8,53.2,-17.5,53.2" stroke="#6cc9e5" stroke-width="2" stroke-linejoin="round" fill="none" stroke-linecap="round"/>
    <path ed:tosuperid="248" transform="matrix(1,0,0,1,207.15,407.84)" id="249" ed:parentid="145" d="M17.5,35.5C-4,35.5,10.5,-35.5,-17.6,-35.5" stroke="#f1a3dc" stroke-width="2" stroke-linejoin="round" fill="none" stroke-linecap="round"/>
    <path ed:tosuperid="250" transform="matrix(1,0,0,1,207.15,425.56)" id="251" ed:parentid="145" d="M17.5,17.7C-0.6,17.7,2.5,-17.7,-17.5,-17.7" stroke="#f1a3dc" stroke-width="2" stroke-linejoin="round" fill="none" stroke-linecap="round"/>
    <path ed:tosuperid="256" transform="matrix(1,0,0,1,207.15,443.29)" id="257" ed:parentid="145" d="M17.5,0C3.5,0,-7,0,-17.5,0" stroke="#f1a3dc" stroke-width="2" stroke-linejoin="round" fill="none" stroke-linecap="round"/>
    <path ed:tosuperid="264" transform="matrix(1,0,0,1,207.15,461.01)" id="265" ed:parentid="145" d="M17.6,-17.7C-0.6,-17.7,2.5,17.7,-17.6,17.7" stroke="#f1a3dc" stroke-width="2" stroke-linejoin="round" fill="none" stroke-linecap="round"/>
    <path ed:tosuperid="266" transform="matrix(1,0,0,1,207.15,478.74)" id="267" ed:parentid="145" d="M17.5,-35.5C-4,-35.5,10.5,35.5,-17.6,35.5" stroke="#f1a3dc" stroke-width="2" stroke-linejoin="round" fill="none" stroke-linecap="round"/>
    <path ed:tosuperid="268" transform="matrix(1,0,0,1,387.15,593.86)" id="269" ed:parentid="246" d="M17.5,17.7C-0.6,17.7,2.5,-17.7,-17.5,-17.7" stroke="#ffcd55" stroke-width="2" stroke-linejoin="round" fill="none" stroke-linecap="round"/>
    <path ed:tosuperid="270" transform="matrix(1,0,0,1,387.15,611.59)" id="271" ed:parentid="246" d="M17.5,0C3.5,0,-7,-0,-17.5,-0" stroke="#ffcd55" stroke-width="2" stroke-linejoin="round" fill="none" stroke-linecap="round"/>
    <path ed:tosuperid="272" transform="matrix(1,0,0,1,387.15,629.31)" id="273" ed:parentid="246" d="M17.5,-17.7C-0.6,-17.7,2.5,17.7,-17.5,17.7" stroke="#ffcd55" stroke-width="2" stroke-linejoin="round" fill="none" stroke-linecap="round"/>
    <g transform="matrix(1,0,0,1,704.7,246.54)" ed:width="256.4" ed:layout="map" ed:topictype="mainidea" id="101" ed:height="322.6">
        <path d="M4,0L252.4,0C255.1,0,256.4,1.3,256.4,4L256.4,318.6C256.4,321.3,255.1,322.6,252.4,322.6L4,322.6C1.3,322.6,0,321.3,0,318.6L0,4C0,1.3,1.3,0,4,0z" stroke="#ffffff" stroke-width="4" stroke-linejoin="round" fill="#ffffff"/>
        <image width="210.4" xlink:href="" height="289.6" x="17" id="shape4" y="15"/>
        <text class="st15"/>
    </g>
    <g transform="matrix(1,0,0,1,1024.1,205.57)" ed:width="197" ed:layout="rightmap" id="122" ed:parentid="101" ed:height="38.35">
        <path d="M0,38.4L197,38.4" stroke="#ff7575" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st16">
            <tspan style="white-space:pre" x="17" y="27.4">第一章直流电路</tspan>
        </text>
        <g ed:hyperlink="[&#xa;    {&#xa;        &quot;desc&quot;: &quot;&quot;,&#xa;        &quot;link&quot;: &quot;https://kdocs.cn/l/clcrzxZem0Ke&quot;&#xa;    }&#xa;]&#xa;">
            <use xlink:href="#imghyperlink" transform="translate(164,11)"/>
        </g>
    </g>
    <symbol id="imghyperlink">
        <image width="16" xlink:href="" height="16"/>
    </symbol>
    <g transform="matrix(1,0,0,1,444.7,165.74)" ed:width="197" ed:layout="leftmap" id="139" ed:parentid="101" ed:height="38.35">
        <path d="M0,38.4L197,38.4" stroke="#6cc9e5" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st16">
            <tspan style="white-space:pre" x="17" y="27.4">第三章交流电路</tspan>
        </text>
        <g ed:hyperlink="[&#xa;    {&#xa;        &quot;desc&quot;: &quot;&quot;,&#xa;        &quot;link&quot;: &quot;https://kdocs.cn/l/cvoK76PRgo4M&quot;&#xa;    }&#xa;]&#xa;">
            <use xlink:href="#imghyperlink" transform="translate(164,11)"/>
        </g>
    </g>
    <g transform="matrix(1,0,0,1,224.7,404.94)" ed:width="417" ed:layout="leftmap" id="145" ed:parentid="101" ed:height="38.35">
        <path d="M0,38.4L417,38.4" stroke="#f1a3dc" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st16">
            <tspan style="white-space:pre" x="17" y="27.4">第四章半导体二极管、三极管和场效应管</tspan>
        </text>
        <g ed:hyperlink="[&#xa;    {&#xa;        &quot;desc&quot;: &quot;&quot;,&#xa;        &quot;link&quot;: &quot;https://kdocs.cn/l/clmFKWGDE2lP&quot;&#xa;    }&#xa;]&#xa;">
            <use xlink:href="#imghyperlink" transform="translate(384,11)"/>
        </g>
    </g>
    <g transform="matrix(1,0,0,1,1024.1,533.4)" ed:width="257" ed:layout="rightmap" id="147" ed:parentid="101" ed:height="38.35">
        <path d="M0,38.4L257,38.4" stroke="#5fb7f1" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st16">
            <tspan style="white-space:pre" x="17" y="27.4">第二章电路的过渡过程</tspan>
        </text>
        <g ed:hyperlink="[&#xa;    {&#xa;        &quot;desc&quot;: &quot;&quot;,&#xa;        &quot;link&quot;: &quot;https://kdocs.cn/l/cecy4J8pBCJ4&quot;&#xa;    }&#xa;]&#xa;">
            <use xlink:href="#imghyperlink" transform="translate(224,11)"/>
        </g>
    </g>
    <g transform="matrix(1,0,0,1,404.7,573.24)" ed:width="237" ed:layout="leftmap" id="246" ed:parentid="101" ed:height="38.35">
        <path d="M0,38.4L237,38.4" stroke="#ffcd55" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st16">
            <tspan style="white-space:pre" x="17" y="27.4">第五章放大电路基础</tspan>
        </text>
        <g ed:hyperlink="[&#xa;    {&#xa;        &quot;desc&quot;: &quot;&quot;,&#xa;        &quot;link&quot;: &quot;https://kdocs.cn/l/cgy4Mc25nA1b&quot;&#xa;    }&#xa;]&#xa;">
            <use xlink:href="#imghyperlink" transform="translate(204,11)"/>
        </g>
    </g>
    <g transform="matrix(1,0,0,1,1256.2,20)" ed:width="141.2" ed:layout="rightmap" id="190" ed:parentid="122" ed:height="28.95">
        <path d="M0,29L141.2,29" stroke="#ff7575" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st17">
            <tspan style="white-space:pre" x="8" y="21.4">电路与电路模型</tspan>
        </text>
    </g>
    <g transform="matrix(1,0,0,1,1256.2,55.45)" ed:width="158.8" ed:layout="rightmap" id="196" ed:parentid="122" ed:height="28.95">
        <path d="M0,29L158.8,29" stroke="#ff7575" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st17">
            <tspan style="white-space:pre" x="8" y="21.4">电流、电压和电位</tspan>
        </text>
    </g>
    <g transform="matrix(1,0,0,1,1256.2,90.9)" ed:width="70.8" ed:layout="rightmap" id="198" ed:parentid="122" ed:height="28.95">
        <path d="M0,29L70.8,29" stroke="#ff7575" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st17">
            <tspan style="white-space:pre" x="8" y="21.4">电功率</tspan>
        </text>
    </g>
    <g transform="matrix(1,0,0,1,1256.2,126.35)" ed:width="88.40000000000001" ed:layout="rightmap" id="200" ed:parentid="122" ed:height="28.95">
        <path d="M0,29L88.4,29" stroke="#ff7575" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st17">
            <tspan style="white-space:pre" x="8" y="21.4">电阻元件</tspan>
        </text>
    </g>
    <g transform="matrix(1,0,0,1,1256.2,161.8)" ed:width="141.2" ed:layout="rightmap" id="202" ed:parentid="122" ed:height="28.95">
        <path d="M0,29L141.2,29" stroke="#ff7575" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st17">
            <tspan style="white-space:pre" x="8" y="21.4">电压源与电流源</tspan>
        </text>
    </g>
    <g transform="matrix(1,0,0,1,1256.2,197.25)" ed:width="123.6" ed:layout="rightmap" id="204" ed:parentid="122" ed:height="28.95">
        <path d="M0,29L123.6,29" stroke="#ff7575" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st17">
            <tspan style="white-space:pre" x="8" y="21.4">基尔霍夫定律</tspan>
        </text>
    </g>
    <g transform="matrix(1,0,0,1,1256.2,232.7)" ed:width="141.2" ed:layout="rightmap" id="206" ed:parentid="122" ed:height="28.95">
        <path d="M0,29L141.2,29" stroke="#ff7575" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st17">
            <tspan style="white-space:pre" x="8" y="21.4">简单的电阻电路</tspan>
        </text>
    </g>
    <g transform="matrix(1,0,0,1,1256.2,268.15)" ed:width="141.2" ed:layout="rightmap" id="208" ed:parentid="122" ed:height="28.95">
        <path d="M0,29L141.2,29" stroke="#ff7575" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st17">
            <tspan style="white-space:pre" x="8" y="21.4">支路电流分析法</tspan>
        </text>
    </g>
    <g transform="matrix(1,0,0,1,1256.2,303.6)" ed:width="141.2" ed:layout="rightmap" id="210" ed:parentid="122" ed:height="28.95">
        <path d="M0,29L141.2,29" stroke="#ff7575" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st17">
            <tspan style="white-space:pre" x="8" y="21.4">节点电位分析法</tspan>
        </text>
    </g>
    <g transform="matrix(1,0,0,1,1256.2,339.05)" ed:width="88.40000000000001" ed:layout="rightmap" id="212" ed:parentid="122" ed:height="28.95">
        <path d="M0,29L88.4,29" stroke="#ff7575" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st17">
            <tspan style="white-space:pre" x="8" y="21.4">叠加原理</tspan>
        </text>
    </g>
    <g transform="matrix(1,0,0,1,1256.2,374.5)" ed:width="123.6" ed:layout="rightmap" id="214" ed:parentid="122" ed:height="28.95">
        <path d="M0,29L123.6,29" stroke="#ff7575" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st17">
            <tspan style="white-space:pre" x="8" y="21.4">等效电源定理</tspan>
        </text>
    </g>
    <g transform="matrix(1,0,0,1,1256.2,409.95)" ed:width="176.4" ed:layout="rightmap" id="216" ed:parentid="122" ed:height="28.95">
        <path d="M0,29L176.4,29" stroke="#ff7575" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st17">
            <tspan style="white-space:pre" x="8" y="21.4">含受控源的电阻电路</tspan>
        </text>
    </g>
    <g transform="matrix(1,0,0,1,1316.2,471.9)" ed:width="176.4" ed:layout="rightmap" id="218" ed:parentid="147" ed:height="28.95">
        <path d="M0,29L176.4,29" stroke="#5fb7f1" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st17">
            <tspan style="white-space:pre" x="8" y="21.4">电容元件与电感元件</tspan>
        </text>
    </g>
    <g transform="matrix(1,0,0,1,1316.2,507.35)" ed:width="264.4" ed:layout="rightmap" id="220" ed:parentid="147" ed:height="28.95">
        <path d="M0,29L264.4,29" stroke="#5fb7f1" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st17">
            <tspan style="white-space:pre" x="8" y="21.4">动态电路的过渡过程和初始条件</tspan>
        </text>
    </g>
    <g transform="matrix(1,0,0,1,1316.2,542.8)" ed:width="194" ed:layout="rightmap" id="222" ed:parentid="147" ed:height="28.95">
        <path d="M0,29L194,29" stroke="#5fb7f1" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st17">
            <tspan style="white-space:pre" x="8" y="21.4">一阶电路的零输入响应</tspan>
        </text>
    </g>
    <g transform="matrix(1,0,0,1,1316.2,578.25)" ed:width="194" ed:layout="rightmap" id="224" ed:parentid="147" ed:height="28.95">
        <path d="M0,29L194,29" stroke="#5fb7f1" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st17">
            <tspan style="white-space:pre" x="8" y="21.4">一阶电路的零状态响应</tspan>
        </text>
    </g>
    <g transform="matrix(1,0,0,1,1316.2,613.7)" ed:width="158.8" ed:layout="rightmap" id="226" ed:parentid="147" ed:height="28.95">
        <path d="M0,29L158.8,29" stroke="#5fb7f1" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st17">
            <tspan style="white-space:pre" x="8" y="21.4">一阶电路的全响应</tspan>
        </text>
    </g>
    <g transform="matrix(1,0,0,1,215.6,68.79)" ed:width="194" ed:layout="leftmap" id="228" ed:parentid="139" ed:height="28.95">
        <path d="M0,29L194,29" stroke="#6cc9e5" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st17">
            <tspan style="white-space:pre" x="8" y="21.4">正弦交流电的基本概念</tspan>
        </text>
    </g>
    <g transform="matrix(1,0,0,1,233.2,104.24)" ed:width="176.4" ed:layout="leftmap" id="230" ed:parentid="139" ed:height="28.95">
        <path d="M0,29L176.4,29" stroke="#6cc9e5" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st17">
            <tspan style="white-space:pre" x="8" y="21.4">正弦量的相量表示法</tspan>
        </text>
    </g>
    <g transform="matrix(1,0,0,1,250.8,139.69)" ed:width="158.8" ed:layout="leftmap" id="232" ed:parentid="139" ed:height="28.95">
        <path d="M0,29L158.8,29" stroke="#6cc9e5" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st17">
            <tspan style="white-space:pre" x="8" y="21.4">单一元件参数电路</tspan>
        </text>
    </g>
    <g transform="matrix(1,0,0,1,22,175.14)" ed:width="387.6" ed:layout="leftmap" id="234" ed:parentid="139" ed:height="28.95">
        <path d="M0,29L387.6,29" stroke="#6cc9e5" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st17">
            <tspan style="white-space:pre" x="8" y="21.4">简单的正弦交流电路复杂交流电路的分析与计算</tspan>
        </text>
    </g>
    <g transform="matrix(1,0,0,1,233.2,210.59)" ed:width="176.4" ed:layout="leftmap" id="240" ed:parentid="139" ed:height="28.95">
        <path d="M0,29L176.4,29" stroke="#6cc9e5" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st17">
            <tspan style="white-space:pre" x="8" y="21.4">正弦交流电路的功率</tspan>
        </text>
    </g>
    <g transform="matrix(1,0,0,1,215.6,246.04)" ed:width="194" ed:layout="leftmap" id="242" ed:parentid="139" ed:height="28.95">
        <path d="M0,29L194,29" stroke="#6cc9e5" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st17">
            <tspan style="white-space:pre" x="8" y="21.4">正弦交流电路中的谐振</tspan>
        </text>
    </g>
    <g transform="matrix(1,0,0,1,286,281.49)" ed:width="123.6" ed:layout="leftmap" id="244" ed:parentid="139" ed:height="28.95">
        <path d="M0,29L123.6,29" stroke="#6cc9e5" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st17">
            <tspan style="white-space:pre" x="8" y="21.4">三相交流电路</tspan>
        </text>
    </g>
    <g transform="matrix(1,0,0,1,130.8,343.44)" ed:width="58.8" ed:layout="leftmap" id="248" ed:parentid="145" ed:height="28.95">
        <path d="M0,29L58.8,29" stroke="#f1a3dc" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st17">
            <tspan style="white-space:pre" x="8" y="21.4">PN结</tspan>
        </text>
    </g>
    <g transform="matrix(1,0,0,1,66,378.89)" ed:width="123.6" ed:layout="leftmap" id="250" ed:parentid="145" ed:height="28.95">
        <path d="M0,29L123.6,29" stroke="#f1a3dc" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st17">
            <tspan style="white-space:pre" x="8" y="21.4">半导体二极管</tspan>
        </text>
    </g>
    <g transform="matrix(1,0,0,1,66,414.34)" ed:width="123.6" ed:layout="leftmap" id="256" ed:parentid="145" ed:height="28.95">
        <path d="M0,29L123.6,29" stroke="#f1a3dc" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st17">
            <tspan style="white-space:pre" x="8" y="21.4">双极性三极管</tspan>
        </text>
    </g>
    <g transform="matrix(1,0,0,1,101.2,449.79)" ed:width="88.40000000000001" ed:layout="leftmap" id="264" ed:parentid="145" ed:height="28.95">
        <path d="M0,29L88.4,29" stroke="#f1a3dc" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st17">
            <tspan style="white-space:pre" x="8" y="21.4">场效应管</tspan>
        </text>
    </g>
    <g transform="matrix(1,0,0,1,83.6,485.24)" ed:width="106" ed:layout="leftmap" id="266" ed:parentid="145" ed:height="28.95">
        <path d="M0,29L106,29" stroke="#f1a3dc" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st17">
            <tspan style="white-space:pre" x="8" y="21.4">光电三极管</tspan>
        </text>
    </g>
    <g transform="matrix(1,0,0,1,140.4,547.19)" ed:width="229.2" ed:layout="leftmap" id="268" ed:parentid="246" ed:height="28.95">
        <path d="M0,29L229.2,29" stroke="#ffcd55" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st17">
            <tspan style="white-space:pre" x="8" y="21.4">放大电路的组成及工作原理</tspan>
        </text>
    </g>
    <g transform="matrix(1,0,0,1,263.6,582.64)" ed:width="106" ed:layout="leftmap" id="270" ed:parentid="246" ed:height="28.95">
        <path d="M0,29L106,29" stroke="#ffcd55" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st17">
            <tspan style="white-space:pre" x="8" y="21.4">图解分析法</tspan>
        </text>
    </g>
    <g transform="matrix(1,0,0,1,263.6,618.09)" ed:width="106" ed:layout="leftmap" id="272" ed:parentid="246" ed:height="28.95">
        <path d="M0,29L106,29" stroke="#ffcd55" stroke-width="2" stroke-linejoin="round" fill="none"/>
        <text class="st17">
            <tspan style="white-space:pre" x="8" y="21.4">计算分析法</tspan>
        </text>
    </g>
</svg>
</div>
        <div id="copyright">Created With  <a href="https://www.edrawsoft.com/" target="_blank" title="edrawsoft">MindMaster</a></div>
      </div>
    </div>
    <script>eval(atob('dmFyIG11YSA9IHdpbmRvdy5uYXZpZ2F0b3IudXNlckFnZW50Ow0KdmFyIHVhID0gKG11YS5pbmRleE9mKCdydjoxMScpICsgbXVhLmluZGV4T2YoJ01TSUUnKSkgPj0gMDsNCmRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdzdmctY29udGFpbmVyJykub25jb250ZXh0bWVudSA9IGZ1bmN0aW9uIChldmVudCkgew0KICAgIGV2ZW50LnByZXZlbnREZWZhdWx0KCk7DQp9DQpkb2N1bWVudC5nZXRFbGVtZ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TsNCiAgICAgICAgICAgIG4udGV4dENvbnRlbnQgPSBuYW1lICsgJzogJzsNCiAgICAgICAgICAgIG4uc2V0QXR0cmlidXRlKCdmb250LXNpemUnLCAnMTInKTsNCiAgICAgICAgICAgIHQuc2V0QXR0cmlidXRlKCd4JywgMjAwKTsNCiAgICAgICAgICAgIHQuc2V0QXR0cmlidXRlKCd5JywgMTIpOw0KICAgICAgICAgICAgdC5zZXRBdHRyaWJ1dGUoJ2ZpbGwnLCAnIzk2OTY5NicpOw0KICAgICAgICAgICAgdC50ZXh0Q29udGVudCA9IHRpbWU7DQogICAgICAgICAgICB0LnNldEF0dHJpYnV0ZSgnZm9udC1zaXplJywgJzEwJyk7DQogICAgICAgICAgICBtLnNldEF0dHJpYnV0ZSgndHJhbnNmb3JtJywgJ3RyYW5zbGF0ZSgyMCwyNyknKTsNCiAgICAgICAgICAgIG0uc2V0QXR0cmlidXRlKCdmb250LXNpemUnLCAnMTInKTsNCiAgICAgICAgICAgIGZvciAodmFyIGsgPSAwOyBrIDwgbWVzc2FnZUFyci5sZW5ndGg7IGsrKykgew0KICAgICAgICAgICAgICAgIHZhciB0cyA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnROUygnaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnLCAndHNwYW4nKTsNCiAgICAgICAgICAgICAgICB0cy5zZXRBdHRyaWJ1dGUoJ3gnLCAnMCcpOw0KICAgICAgICAgICAgICAgIHRzLnNldEF0dHJpYnV0ZSgneScsIGsgKiAxNik7DQogICAgICAgICAgICAgICAgdHMudGV4dENvbnRlbnQgPSBtZXNzYWdlQXJyW2tdOw0KICAgICAgICAgICAgICAgIG0uYXBwZW5kQ2hpbGQodHMpOw0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgby5zZXRBdHRyaWJ1dGUoJ3RyYW5zZm9ybScsICd0cmFuc2xhdGUoMCwnICsgaGVpZ2h0ICsgJyknKTsNCiAgICAgICAgICAgIG8uYXBwZW5kQ2hpbGQobik7DQogICAgICAgICAgICBvLmFwcGVuZENoaWxkKHQpOw0KICAgICAgICAgICAgby5hcHBlbmRDaGlsZChtKTsNCiAgICAgICAgICAgIGNhcnIucHVzaChvKTsNCiAgICAgICAgICAgIHBvcHVwLmFwcGVuZENoaWxkKG8pOw0KICAgICAgICAgICAgaGVpZ2h0ID0gKG1lc3NhZ2VBcnIubGVuZ3RoICsgMSkgKiAxNiArIGhlaWdodDsNCiAgICAgICAgfQ0KICAgICAgICB2YXIgd2FyciA9IGdldGN3aChwb3B1cCk7DQogICAgICAgIG9saW5lLnNldEF0dHJpYnV0ZSgneCcsICcwJyk7DQogICAgICAgIG9saW5lLnNldEF0dHJpYnV0ZSgneScsICcwJyk7DQogICAgICAgIHZhciBvdyA9IHdhcnJbMF0gKyAxMC41Ow0KICAgICAgICB2YXIgb2ggPSB3YXJyWzFdICsgMzsNCiAgICAgICAgb2xpbmUuc2V0QXR0cmlidXRlKCd3aWR0aCcsIG93KTsNCiAgICAgICAgb2xpbmUuc2V0QXR0cmlidXRlKCdoZWlnaHQnLCBvaCk7DQogICAgICAgIG9saW5lLnNldEF0dHJpYnV0ZSgnZmlsbCcsICd3aGl0ZScpOw0KICAgICAgICBvbGluZS5zZXRBdHRyaWJ1dGUoJ3N0cm9rZScsICcjNjU2NTY1Jyk7DQogICAgICAgIHBvcHVwLmFwcGVuZENoaWxkKG9saW5lKTsNCiAgICAgICAgdmFyIGwgPSBjYXJyLmxlbmd0aDsNCiAgICAgICAgd2hpbGUgKGwtLSkgew0KICAgICAgICAgICAgcG9wdXAuYXBwZW5kQ2hpbGQoY2FycltsXSk7DQogICAgICAgIH0NCiAgICAgICAgcG9wdXAub25tb3VzZW92ZXIgPSBmdW5jdGlvbiAoKSB7DQogICAgICAgICAgICB0aGlzLnN0eWxlLmRpc3BsYXkgPSAnYmxvY2snOw0KICAgICAgICB9Ow0KICAgICAgICBwb3B1cC5vbm1vdXNlb3V0ID0gZnVuY3Rpb24gKCkgew0KICAgICAgICA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cHNbMV0pLCBwYXJzZUZsb2F0KHBwc1szXSksIHBhcnNlRmxvYXQocHBzWzVdKSwgcGFyc2VGbG9hdChwcHNbN10pLCBwYXJzZUZsb2F0KHBwc1s5XSksIHBhcnNlRmxvYXQocHBzWzExXSldOw0KICAgICAgICAgICAgaWYgKG1hQXJyWzFdID09IDApIHsNCiAgICAgICAgICAgICAgICB2YXIgeCA9IHBhcnNlRmxvYXQoY3NbMF0pOw0KICAgICAgICAgICAgICAgIHZhciB5ID0gcGFyc2VGbG9hdChjc1sxXSkgKyAxNjsNCiAgICAgICAgICAgICAgICB2YXIgeDEgPSB4ICogbWFBcnJbMF0gKyB5ICogbWFBcnJbMl0gKyBtYUFycls0XTsNCiAgICAgICAgICAgICAgICB2YXIgeTEgPSB4ICogbWFBcnJbMV0gKyB5ICogbWFBcnJbM10gKyBtYUFycls1XTsNCiAgICAgICAgICAgICAgICB4MSA9IHgxLnRvc3VpdHN2ZygpOw0KICAgICAgICAgICAgICAgIHkxID0geTEudG9zdWl0c3ZnKCk7DQogICAgICAgICAgICAgICAgdmFyIHRyc3RyID0gJ3RyYW5zbGF0ZSgnICsgeDEgKyAnLCcgKyB5MSArICcpJzsNCiAgICAgICAgICAgIH0gZWxzZSB7DQogICAgICAgICAgICAgICAgdmFyIHggPSBwYXJzZUZsb2F0KGNzWzBdKSArIDE2Ow0KICAgICAgICAgICAgICAgIHZhciB5ID0gcGFyc2VGbG9hdChjc1sxXSkgKyAxNjsNCiAgICAgICAgICAgICAgICB2YXIgeDEgPSB4ICogbWFBcnJbMF0gKyB5ICogbWFBcnJbMl0gKyBtYUFycls0XTsNCiAgICAgICAgICAgICAgICB2YXIgeTEgPSB4ICogbWFBcnJbMV0gKyB5ICogbWFBcnJbM10gKyBtYUFycls1XTsNCiAgICAgICAgICAgICAgICB4ID0gcGFyc2VGbG9hdChjc1swXSkgKyAxNjsNCiAgICAgICAgICAgICAgICB5ID0gcGFyc2VGbG9hdChjc1sxXSk7DQogICAgICAgICAgICAgICAgdmFyIHgyID0geCAqIG1hQXJyWzBdICsgeSAqIG1hQXJyWzJdICsgbWFBcnJbNF07DQogICAgICAgICAgICAgICAgdmFyIHkyID0geCAqIG1hQXJyWzFdICsgeSAqIG1hQXJyWzNdICsgbWFBcnJbNV07DQogICAgICAgICAgICAgICAgdmFyIGZ4ID0geDEgPCB4MiA/IHgxLnRvc3VpdHN2ZygpIDogeDIudG9zdWl0c3ZnKCk7DQogICAgICAgICAgICAgICAgdmFyIGZ5ID0geTEgPiB5MiA/IHkxLnRvc3VpdHN2ZygpIDogeTIudG9zdWl0c3ZnKCk7DQogICAgICAgICAgICAgICAgdmFyIG9mZnkgPSBNYXRoLmFicyh5MSAtIHkyKTsNCiAgICAgICAgICAgICAgICB2YXIgdHJzdHIgPSAndHJhbnNsYXRlKCcgKyBmeCArICcsJyArIGZ5ICsgJyknOw0KICAgICAgICAgICAgICAgIHBvcHVwUi5zZXRBdHRyaWJ1dGUoJ2hlaWdodCcsIG9mZnkudG9TdHJpbmcoKSk7DQogICAgICAgICAgICAgICAgcG9wdXBSLnNldEF0dHJpYnV0ZSgnd2lkdGgnLCAnMTYnKTsNCiAgICAgICAgICAgICAgICBwb3B1cFIuc2V0QXR0cmlidXRlKCd5JywgKC1vZmZ5KS50b1N0cmluZygpKTsNCiAgICAgICAgICAgICAgICBwb3B1cFIuc2V0QXR0cmlidXRlKCdmaWxsJywgJ3RyYW5zcGFyZW50Jyk7DQogICAgICAgICAgICAgICAgcG9wdXAuYXBwZW5kQ2hpbGQocG9wdXBSKTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfQ0KICAgICAgICBwb3B1cC5zZXRBdHRyaWJ1dGUoJ3RyYW5zZm9ybScsIHRyc3RyKTsNCiAgICAgICAgcG9wdXAuc2V0QXR0cmlidXRlKCdjb21tZW50JywgJycpOw0KICAgICAgICBwb3B1cC5zdHlsZS5kaXNwbGF5ID0gJ25vbmUnOw0KICAgICAgICBsZXQgY29tbWVudGlkID0gY29tbWV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1hQXJyID0gW3BhcnNlRmxvYXQocHBzWzFdKSwgcGFyc2VGbG9hdChwcHNbM10pLCBwYXJzZUZsb2F0KHBwc1s1XSksIHBhcnNlRmxvYXQocHBzWzddKSwgcGFyc2VGbG9hdChwcHNbOV0pLCBwYXJzZUZsb2F0KHBwc1sxMV0pXTsNCiAgICAgICAgICAgICAgICBpZiAobWFBcnJbMV0gPT0gMCkgew0KICAgICAgICAgICAgICAgICAgICB2YXIgeCA9IHBhcnNlRmxvYXQoY3NbMF0pOw0KICAgICAgICAgICAgICAgICAgICB2YXIgeSA9IHBhcnNlRmxvYXQoY3NbMV0pICsgMTY7DQogICAgICAgICAgICAgICAgICAgIHZhciB4MSA9IHggKiBtYUFyclswXSArIHkgKiBtYUFyclsyXSArIG1hQXJyWzRdOw0KICAgICAgICAgICAgICAgICAgICB2YXIgeTEgPSB4ICogbWFBcnJbMV0gKyB5ICogbWFBcnJbM10gKyBtYUFycls1XTsNCiAgICAgICAgICAgICAgICAgICAgeDEgPSB4MS50b3N1aXRzdmcoKTsNCiAgICAgICAgICAgICAgICAgICAgeTEgPSB5MS50b3N1aXRzdmcoKTsNCiAgICAgICAgICAgICAgICAgICAgdmFyIHRyc3RyID0gJ3RyYW5zbGF0ZSgnICsgeDEgKyAnLCcgKyB5MSArICcpJzsNCiAgICAgICAgICAgICAgICB9IGVsc2Ugew0KICAgICAgICAgICAgICAgICAgICB2YXIgeCA9IHBhcnNlRmxvYXQoY3NbMF0pICsgMTY7DQogICAgICAgICAgICAgICAgICAgIHZhciB5ID0gcGFyc2VGbG9hdChjc1sxXSkgKyAxNjsNCiAgICAgICAgICAgICAgICAgICAgdmFyIHgxID0geCAqIG1hQXJyWzBdICsgeSAqIG1hQXJyWzJdICsgbWFBcnJbNF07DQogICAgICAgICAgICAgICAgICAgIHZhciB5MSA9IHggKiBtYUFyclsxXSArIHkgKiBtYUFyclszXSArIG1hQXJyWzVdOw0KICAgICAgICAgICAgICAgICAgICB4ID0gcGFyc2VGbG9hdChjc1swXSkgKyAxNjsNCiAgICAgICAgICAgICAgICAgICAgeSA9IHBhcnNlRmxvYXQoY3NbMV0pOw0KICAgICAgICAgICAgICAgICAgICB2YXIgeDIgPSB4ICogbWFBcnJbMF0gKyB5ICogbWFBcnJbMl0gKyBtYUFycls0XTsNCiAgICAgICAgICAgICAgICAgICAgdmFyIHkyID0geCAqIG1hQXJyWzFdICsgeSAqIG1hQXJyWzNdICsgbWFBcnJbNV07DQogICAgICAgICAgICAgICAgICAgIHZhciBmeCA9IHgxIDwgeDIgPyB4MS50b3N1aXRzdmcoKSA6IHgyLnRvc3VpdHN2ZygpOw0KICAgICAgICAgICAgICAgICAgICB2YXIgZnkgPSB5MSA+IHkyID8geTEudG9zdWl0c3ZnKCkgOiB5Mi50b3N1aXRzdmcoKTsNCiAgICAgICAgICAgICAgICAgICAgdmFyIG9mZnkgPSBNYXRoLmFicyh5MSAtIHkyKTsNCiAgICAgICAgICAgICAgICAgICAgdmFyIHRyc3RyID0gJ3RyYW5zbGF0ZSgnICsgZnggKyAnLCcgKyBmeSArICcpJzsNCiAgICAgICAgICAgICAgICAgICAgcG9wdXBSLnNldEF0dHJpYnV0ZSgnaGVpZ2h0Jywgb2ZmeS50b1N0cmluZygpKTsNCiAgICAgICAgICAgICAgICAgICAgcG9wdXBSLnNldEF0dHJpYnV0ZSgnd2lkdGgnLCAnMTYnKTsNCiAgICAgICAgICAgICAgICAgICAgcG9wdXBSLnNldEF0dHJpYnV0ZSgneScsICgtb2ZmeSkudG9TdHJpbmcoKSk7DQogICAgICAgICAgICAgICAgICAgIHBvcHVwUi5zZXRBdHRyaWJ1dGUoJ2ZpbGwnLCAndHJhbnNwYXJlbnQnKTsNCiAgICAgICAgICAgICAgICAgICAgcG9wdXAuYXBwZW5kQ2hpbGQocG9wdXBSKTsNCiAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICB9DQogICAgICAgICAgICBvdXQuc2V0QXR0cmlidXRlKCd0cmFuc2Zvcm0nLCB0cn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yaWJ1dGUoJ3RyYW5zZm9ybScpOw0KICAgICAgICBpZiAocHMuc3Vic3RyKDAsIDIpID09ICd0cicpIHsNCiAgICAgICAgICAgIHZhciBwcHMgPSBwcy5tYXRjaCgvXCgoXFMqfFxTKlxzXFMqKVwpLylbMV0uc3BsaXQoLyB8LC8pOw0KICAgICAgICAgICAgdmFyIHggPSBwYXJzZUZsb2F0KGNzWzBdKSArIHBhcnNlRmxvYXQocHBzWzBdKTsNCiAgICAgICAgICAgIHZhciB5ID0gcGFyc2VGbG9hdChwcHNbMV0pOw0KICAgICAgICAgICAgeCA9IHgudG9zdWl0c3ZnKCk7DQogICAgICAgICAgICB5ID0geS50b3N1aXRzdmcoKTsNCiAgICAgICAgICAgIHZhciB0cnN0ciA9ICd0cmFuc2xhdGUoJyArIHggKyAnLCcgKyB5ICsgJyknOw0KICAgICAgICB9IGVsc2UgaWYgKHBzLnN1YnN0cigwLCAyKSA9PSAnbWEnKSB7DQogICAgICAgICAgICB2YXIgcHBzID0gcHMubWF0Y2goLyhcLT9cZCsoXC5cZCspPylbXCwgXShcLT9cZCsoXC5cZCspPylbXCwgXShcLT9cZCsoXC5cZCspPylbXCwgXShcLT9cZCsoXC5cZCspPylbXCwgXShcLT9cZCsoXC5cZCspPylbXCwgXShcLT9cZCsoXC5cZCspPylcKSQvKTsNCiAgICAgICAgICAgIHZhciBtYUFyciA9IFtwYXJzZUZsb2F0KHBwc1sxXSksIHBhcnNlRmxvYXQocHBzWzNdKSwgcGFyc2VGbG9hdChwcHNbNV0pLCBwYXJzZUZsb2F0KHBwc1s3XSksIHBhcnNlRmxvYXQocHBzWzldKSwgcGFyc2VGbG9hdChwcHNbMTFdKV07DQogICAgICAgICAgICBpZiAobWFBcnJbMV0gPT0gMCkgew0KICAgICAgICAgICAgICAgIHZhciB4ID0gcGFyc2VGbG9hdChjc1swXSk7DQogICAgICAgICAgICAgICAgdmFyIHkgPSBwYXJzZUZsb2F0KGNzWzFdKSArIDE2Ow0KICAgICAgICAgICAgICAgIHZhciB4MSA9IHggKiBtYUFyclswXSArIHkgKiBtYUFyclsyXSArIG1hQXJyWzRdOw0KICAgICAgICAgICAgICAgIHZhciB5MSA9IHggKiBtYUFyclsxXSArIHkgKiBtYUFyclszXSArIG1hQXJyWzVdOw0KICAgICAgICAgICAgICAgIHgxID0geDEudG9zdWl0c3ZnKCk7DQogICAgICAgICAgICAgICAgeTEgPSB5MS50b3N1aXRzdmcoKTsNCiAgICAgICAgICAgICAgICB2YXIgdHJzdHIgPSAndHJhbnNsYXRlKCcgKyB4MSArICcsJyArIHkxICsgJyknOw0KICAgICAgICAgICAgfSBlbHNlIHsNCiAgICAgICAgICAgICAgICB2YXIgeCA9IHBhcnNlRmxvYXQoY3NbMF0pICsgMTY7DQogICAgICAgICAgICAgICAgdmFyIHkgPSBwYXJzZUZsb2F0KGNzWzFdKSArIDE2Ow0KICAgICAgICAgICAgICAgIHZhciB4MSA9IHggKiBtYUFyclswXSArIHkgKiBtYUFyclsyXSArIG1hQXJyWzRdOw0KICAgICAgICAgICAgICAgIHZhciB5MSA9IHggKiBtYUFyclsxXSArIHkgKiBtYUFyclszXSArIG1hQXJyWzVdOw0KICAgICAgICAgICAgICAgIHggPSBwYXJzZUZsb2F0KGNzWzBdKSArIDE2Ow0KICAgICAgICAgICAgICAgIHkgPSBwYXJzZUZsb2F0KGNzWzFdKTsNCiAgICAgICAgICAgICAgICB2YXIgeDIgPSB4ICogbWFBcnJbMF0gKyB5ICogbWFBcnJbMl0gKyBtYUFycls0XTsNCiAgICAgICAgICAgICAgICB2YXIgeTIgPSB4ICogbWFBcnJbMV0gKyB5ICogbWFBcnJbM10gKyBtYUFycls1XTsNCiAgICAgICAgICAgICAgICB2YXIgZnggPSB4MSA8IHgyID8geDEudG9zdWl0c3ZnKCkgOiB4Mi50b3N1aXRzdmcoKTsNCiAgICAgICAgICAgICAgICB2YXIgZnkgPSB5MSA+IHkyID8geTEudG9zdWl0c3ZnKCkgOiB5Mi50b3N1aXRzdmcoKTsNCiAgICAgICAgICAgICAgICB2YXIgb2ZmeSA9IE1hdGguYWJzKHkxIC0geTIpOw0KICAgICAgICAgICAgICAgIHZhciB0cnN0ciA9ICd0cmFuc2xhdGUoJyArIGZ4ICsgJywnICsgZnkgKyAnKSc7DQogICAgICAgICAgICAgICAgcG9wdXBSLnNldEF0dHJpYnV0ZSgnaGVpZ2h0Jywgb2ZmeS50b1N0cmluZygpKTsNCiAgICAgICAgICAgICAgICBwb3B1cFIuc2V0QXR0cmlidXRlKCd3aWR0aCcsICcxNicpOw0KICAgICAgICAgICAgICAgIHBvcHVwUi5zZXRBdHRyaWJ1dGUoJ3knLCAoLW9mZnkpLnRvU3RyaW5nKCkpOw0KICAgICAgICAgICAgICAgIHBvcHVwUi5zZXRBdHRyaWJ1dGUoJ2ZpbGwnLCAndHJhbnNwYXJlbnQnKTsNCiAgICAgICAgICAgICAgICBwb3B1cC5hcHBlbmRDaGlsZChwb3B1cFIpOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9DQogICAgICAgIHZhciBhbCA9IGEubGVuZ3RoOw0KICAgICAgICBmb3IgKHZhciBqID0gMDsgaiA8IGFsOyBqKyspIHsNCiAgICAgICAgICAgIGxpbmthcnIucHVzaChhW2pdLmxpbmspOw0KICAgICAgICAgICAgZGVzY2Fyci5wdXNoKGFbal0uZGVzYyk7DQogICAgICAgIH0NCiAgICAgICAgcG9wdXAuc2V0QXR0cmlidXRlKCd0cmFuc2Zvcm0nLCB0cnN0cik7DQogICAgICAgIHZhciBtYXggPSBnZXRtYXhsZW4obGlua2FyciwgZGVzY2Fycik7DQogICAgICAgIGZvciAodmFyIGsgPSAwOyBrIDwgYWw7IGsrKykgew0KICAgICAgICAgICAgdmFyIGMgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50TlMoJ2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJywgJ2EnKTsNCiAgICAgICAgICAgIHZhciBkID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudE5TKCdodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZycsICdyZWN0Jyk7DQogICAgICAgICAgICB2YXIgZSA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnROUygnaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnLCAndGV4dCcpOw0KICAgICAgICAgICAgdmFyIGYgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50TlMoJ2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJywgJ3RleHQnKTsNCiAgICAgICAgICAgIGlmIChpc05hTihsaW5rYXJyW2tdKSkgew0KICAgICAgICAgICAgICAgIGMuc2V0QXR0cmlidXRlTlMoImh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiwgInhsaW5rIiwgImh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiKTsNCiAgICAgICAgICAgICAgICBjLnNldEF0dHJpYnV0ZU5TKCJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiwgImhyZWYiLCBsaW5rYXJyW2tdKTsNCiAgICAgICAgICAgICAgICBjLnNldEF0dHJpYnV0ZSgndGFyZ2V0JywgJ19ibGFuaycpOw0KICAgICAgICAgICAgICAgIGUudGV4dENvbnRlbnQgPSBsaW5rYXJyW2tdOw0KICAgICAgICAgICAgfSBlbHNlIHsNCiAgICAgICAgICAgICAgICBlLnRleHRDb250ZW50ID0gJ1BhZ2UtJyArIGxpbmthcnJba107DQogICAgICAgICAgICAgICAgYy5zZXRBdHRyaWJ1dGVOUygiaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciLCAieGxpbmsiLCAiaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIpOw0KICAgICAgICAgICAgICAgIGMuc2V0QXR0cmlidXRlTlMoImh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiLCAiaHJlZiIsICIjIiArIGxpbmthcnJba10pOw0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZC5zZXRBdHRy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9pZCwNCiAgICAgICAgICAgICAgICAgICAgaXNDOiBmYWxzZQ0KICAgICAgICAgICAgICAgIH07DQogICAgICAgICAgICB9DQogICAgICAgICAgICBvYmpbIm0iICsgaWRdLnJlbGFmcm9tW2luZGV4aWRdID0ge307DQogICAgICAgICAgICBvYmpbIm0iICsgaWRdLnJlbGFmcm9tLmRpc3BsYXkgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZChpZCkuc3R5bGUuZGlzcGxheSAhPT0gJ25vbmUnID8gJ2Jsb2NrJyA6ICdub25lJzsNCiAgICAgICAgfQ0KICAgIH0NCiAgICBpZiAocmVsYXRvLmxlbmd0aCAhPT0gMCkgew0KICAgICAgICBvYmpbIm0iICsgaWRdLnJlbGF0byA9IHt9Ow0KICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IHJlbGF0by5sZW5ndGg7IGkrKykgew0KICAgICAgICAgICAgdmFyIGluZGV4aWQgPSByZWxhdG9baV0uaWQ7DQogICAgICAgICAgICB2YXIgZnJvbWlkID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoaW5kZXhpZCkuZ2V0QXR0cmlidXRlKCdlZDpmcm9taWQnKTsNCiAgICAgICAgICAgIGlmIChleHRyYVJlbGFbaW5kZXhpZF0gPT09IHVuZGVmaW5lZCkgew0KICAgICAgICAgICAgICAgIGV4dHJhUmVsYVtpbmRleGlkXSA9IHsNCiAgICAgICAgICAgICAgICAgICAgaWQ6IGluZGV4aWQsDQogICAgICAgICAgICAgICAgICAgIGZyb21pZDogZnJvbWlkLA0KICAgICAgICAgICAgICAgICAgICB0b2lkOiBpZCwNCiAgICAgICAgICAgICAgICAgICAgaXNDOiBmYWxzZQ0KICAgICAgICAgICAgICAgIH07DQogICAgICAgICAgICB9DQogICAgICAgICAgICBvYmpbIm0iICsgaWRdLnJlbGF0b1tpbmRleGlkXSA9IHt9Ow0KICAgICAgICAgICAgb2JqWyJtIiArIGlkXS5yZWxhdG8uZGlzcGxheSA9IGRvY3V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xkKyg/PVwsKS8pWzBdDQogICAgfQ0KICAgIGdldGNoYWluKHBhcmVudCk7DQp9DQpmdW5jdGlvbiBnZXRvYmooaWQpIHsNCiAgICBjaGFpbkFyciA9IFtdOw0KICAgIGdldGNoYWluKGlkKTsNCiAgICB2YXIgbWFpbiA9IGNoYWluQXJyWzBdOw0KICAgIGlmIChjaGFpbkFyci5sZW5ndGggPiAxKSB7DQogICAgICAgIHZhciBvYmogPSBkYXRhVHJlZVttYWluXTsNCiAgICAgICAgLy8gY29uc29sZS5sb2coY2hhaW5BcnIpOw0KICAgICAgICBmb3IgKHZhciBpID0gMTsgaSA8IGNoYWluQXJyLmxlbmd0aDsgaSsrKSB7DQogICAgICAgICAgICB2YXIgYSA9IGNoYWluQXJyW2ldOw0KICAgICAgICAgICAgZm9yICh2YXIgaiA9IDA7IGogPCBPYmplY3Qua2V5cyhvYmopLmxlbmd0aDsgaisrKSB7DQogICAgICAgICAgICAgICAgdmFyIGNvYmogPSBvYmpbT2JqZWN0LmtleXMob2JqKVtqXV1bYV07DQogICAgICAgICAgICAgICAgaWYgKGNvYmopIHsNCiAgICAgICAgICAgICAgICAgICAgb2JqID0gY29iajsNCiAgICAgICAgICAgICAgICAgICAgY29udGludWUNCiAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICB9DQogICAgICAgIH0NCiAgICAgICAgcmV0dXJuIG9iag0KICAgIH0gZWxzZSB7DQogICAgICAgIHZhciBvYmogPSBkYXRhVHJlZVttYWluXTsNCiAgICAgICAgcmV0dXJuIG9iag0KICAgIH0NCg0KfQ0KZm9yICh2YXIgaSA9IDA7IGkgPCBzaGFwZS5sZW5ndGg7IGkrKykgew0KICAgIHNoYXBlW2ldLm9uY2xpY2sgPSBmdW5jdGlvbiAoKSB7DQogICAgICAgIHZhciBpZCA9IE51bWJlcih0aGlzLmdldEF0dHJpYnV0ZSgnZWQ6dG9ndG9waWNpZCcpKTsNCiAgICAgICAgdmFyIG9iaiA9IGdldG9iaihpZCk7DQoNCiAgICAgICAgdmFyIHR5cGUgPSBvYmoudG9ndHlwZSA9PT0gJ21pbnVzJyA/ICdwbHVzJyA6ICdtaW51cyc7DQogICAgICAgIHZhciBkaXNwbGF5ID0gb2JqLnRvZ3R5cGUgPT09ICdtaW51cycgPyAnbm9uZScgOiAnYmxvY2snOw0KICAgICAgICB0aGlzLmdldEVsZW1lbnRzQnlUYWdOYW1lKCd1c2UnKVswXS5zZXRBdHRyaWJ1dGUoJ3hsaW5rOmhyZWYnLCAnIycgKyB0eXBlKTsNCiAgICAgICAgb2JqLnRvZ3R5cGUgPSB0eXBlOw0KICAgICAgICBjaGVja0lEID0gb2JqOw0KDQogICAgICAgIHV0ZChvYmosIGlkLCBkaXNwbGF5KTsNCiAgICAgICAgZXh0cmFSZWxhRmluKCk7DQogICAgfQ0KfQ0KZnVuY3Rpb24gdXRkKG9iaiwgaWQsIHNob3csIG9jKSB7DQoNCiAgICB2YXIgcHNob3cgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZChpZCkuc3R5bGUuZGlzcGxheSAhPT0gJ25vbmUnID8gJ2Jsb2NrJyA6ICdub25lJzsNCiAgICBpZiAob2JqLnJlbGFmcm9tKSB7DQogICAgICAgIGlmIChvYmoucmVsYWZyb20uZGlzcGxheSAhPT0gcHNob3cpIHsNCiAgICAgICAgICAgIHZhciByZWxhZnJvbXMgPSBPYmplY3Qua2V5cyhvYmoucmVsYWZyb20pOw0KICAgICAgICAgICAgcmVsYWZyb21zLnNwbGljZShyZWxhZnJvbXMuaW5kZXhPZignZGlzcGxheScpLCAxKTsNCiAgICAgICAgICAgIGZvciAodmFyIGsgPSAwOyBrIDwgcmVsYWZyb21zLmxlbmd0aDsgaysrKSB7DQogICAgICAgICAgICAgICAgdmFyIGQgPSByZWxhZnJvbXNba107DQogICAgICAgICAgICAgICAgZXh0cmFSZWxhW2RdLmlzQyA9IHRydWU7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBvYmoucmVsYWZyb20uZGlzcGxheSA9IHBzaG93Ow0KICAgICAgICB9DQogICAgfQ0KICAgIGlmIChvYmoucmVsYXRvKSB7DQogICAgICAgIGlmIChvYmoucmVsYXRvLmRpc3BsYXkgIT09IHBzaG93KSB7DQogICAgICAgICAgICB2YXIgcmVsYXRvcyA9IE9iamVjdC5rZXlzKG9iai5yZWxhdG8pOw0KICAgICAgICAgICAgcmVsYXRvcy5zcGxpY2UocmVsYXRvcy5pbmRleE9mKCdkaXNwbGF5JyksIDEpOw0KICAgICAgICAgICAgZm9yICh2YXIgayA9IDA7IGsgPCByZWxhdG9zLmxlbmd0aDsgaysrKSB7DQogICAgICAgICAgICAgICAgdmFyIGQgPSByZWxhdG9zW2tdOw0KICAgICAgICAgICAgICAgIGV4dHJhUmVsYVtkXS5pc0MgPSB0cnVlOw0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgb2JqLnJlbGF0by5kaXNwbGF5ID0gcHNob3c7DQogICAgICAgIH0NCiAgICB9DQogICAgaWYgKG9iai5jYWxsKSB7DQogICAgICAgIHZhciBjYWxscyA9IE9iamVjdC5rZXlzKG9iai5jYWxsKTsNCiAgICAgICAgaWYgKGNoZWNrSUQgIT09IG9iaikgew0KICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjYWxscy5sZW5ndGg7IGkrKykgew0KICAgICAgICAgICAgICAgIHZhciBhID0gY2FsbHNbaV0uc2xpY2UoMSk7DQogICAgICAgICAgICAgICAgdmFyIGIgPSBvYmouY2FsbFtjYWxsc1tpXV07DQogICAgICAgICAgICAgICAgdmFyIGMgPSBiLnRvZ3R5cGU7DQogICAgICAgICAgICAgICAgZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoYSkuc3R5bGUuZGlzcGxheSA9IHNob3c7DQogICAgICAgICAgICAgICAgaWYgKGIucmVsYWZyb20gJiYgIWMpIHsNCiAgICAgICAgICAgICAgICAgICAgaWYgKGIucmVsYWZyb20uZGlzcGxheSAhPT0gc2hvdykgew0KICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHJlbGFmcm9tcyA9IE9iamVjdC5rZXlzKGIucmVsYWZyb20pOw0KICAgICAgICAgICAgICAgICAgICAgICAgcmVsYWZyb21zLnNwbGljZShyZWxhZnJvbXMuaW5kZXhPZignZGlzcGxheScpLCAxKTsNCiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGsgPSAwOyBrIDwgcmVsYWZyb21zLmxlbmd0aDsgaysrKSB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSByZWxhZnJvbXNba107DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmFSZWxhW2RdLmlzQyA9IHRydWU7DQogICAgICAgICAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgICAgICAgICBiLnJlbGFmcm9tLmRpc3BsYXkgPSBzaG93Ow0KICAgICAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgIGlmIChiLnJlbGF0byAmJiAhYykgew0KICAgICAgICAgICAgICAgICAgICBpZiAoYi5yZWxhdG8uZGlzcGxheSAhPT0gc2hvdykgew0KICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHJlbGF0b3MgPSBPYmplY3Qua2V5cyhiLnJlbGF0byk7DQogICAgICAgICAgICAgICAgICAgICAgICByZWxhdG9zLnNwbGljZShyZWxhdG9zLmluZGV4T2YoJ2Rpc3BsYXknKSwgMSk7DQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBrID0gMDsgayA8IHJlbGF0b3MubGVuZ3RoOyBrKyspIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IHJlbGF0b3Nba107DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmFSZWxhW2RdLmlzQyA9IHRydWU7DQogICAgICAgICAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgICAgICAgICBiLnJlbGF0by5kaXNwbGF5ID0gc2hvdzsNCiAgICAgICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAoYykgew0KICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCJnW2VkXFw6dG9ndG9waWNpZD0nIiArIGEgKyAiJ10iKS5zdHlsZS5kaXNwbGF5ID0gc2hvdzsNCiAgICAgICAgICAgICAgICAgICAgaWYgKGMgPT09ICdtaW51cycpIHsNCiAgICAgICAgICAgICAgICAgICAgICAgIHV0ZChiLCBhLCBzaG93KQ0KICAgICAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgICAgIGlmICgoYi5jYWxsIHx8IGIuYm91bmRhcnkgfHwgYi5zdW1tYXJ5KSAmJiBjID09PSAncGx1cycpIHsNCiAgICAgICAgICAgICAgICAgICAgICAgIHV0ZChiLCBhLCBzaG93LCB0cnVlKQ0KICAgICAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgIGlmIChiLmNhbGwgJiYgIWMpIHsNCiAgICAgICAgICAgICAgICAgICAgdXRkKGIsIGEsIHNob3csIHRydWUpDQogICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgIGlmIChiLnN1bW1hcnkgJiYgIWMpIHsNCiAgICAgICAgICAgICAgICAgICAgdXRkKGIsIGEsIHNob3cpDQogICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgIGlmIChiLmJvdW5kYXJ5ICYmICFjKSB7DQogICAgICAgICAgICAgICAgICAgIHV0ZChiLCBhLCBzaG93KQ0KICAgICAgICAgICAgICAgIH0NCg0KICAgICAgICAgICAgfQ0KICAgICAgICB9DQogICAgfQ0KICAgIGlmIChvYmouc3VtbWFyeSkgew0KICAgICAgICB2YXIgc3VtbWFyeXMgPSBPYmplY3Qua2V5cyhvYmouc3VtbWFyeSk7DQogICAgICAgIGlmICgoY2hlY2tJRCAhPT0gb2JqICYmIChvYmoudG9ndHlwZSA9PT0gJ21pbnVzJyB8fCAhb2JqLnRvZ3R5cGUpKSB8fCBjaGVja0lEID09PSBvYmopIHsNCiAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgc3VtbWFyeXMubGVuZ3RoOyBpKyspIHsNCiAgICAgICAgICAgICAgICB2YXIgYSA9IHN1bW1hcnlzW2ldLnNsaWNlKDEpOw0KICAgICAgICAgICAgICAgIHZhciBvc3AgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZChhKS5nZXRBdHRyaWJ1dGUoJ2VkOnBhcmVudGlkJyk7DQogICAgICAgICAgICAgICAgaWYgKG9zcC5tYXRjaCgvXCwvKSkgew0KICAgICAgICAgICAgICAgICAgICB2YXIgb3NwYSA9IG9zcC5zcGxpdCgnLCcpOw0KICAgICAgICAgICAgICAgICAgICB2YXIgb3NwTCA9IDA7DQoNCiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgaiA9IDA7IGogPCBvc3BhLmxlbmd0aDsgaisrKSB7DQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoc2hvdyA9PSAnbm9uZScpIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQob3NwYVtqXSkuc3R5bGUuZGlzcGxheSAhPSAnbm9uZScpIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3NwTCsrOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKGEpLnN0eWxlLmRpc3BsYXkgIT0gJ25vbmUnKSB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9zcEwrKzsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgICAgICAgICB9DQoNCiAgICAgICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgICAgICBpZiAob3NwTCAhPT0gb3NwYS5sZW5ndGgpIHsNCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOw0KICAgICAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgIHZhciBiID0gb2JqLnN1bW1hcnlbc3VtbWFyeXNbaV1dOw0KICAgICAgICAgICAgICAgIC8vIGNvbnNvbGUubG9nKGEpOw0KICAgICAgICAgICAgICAgIGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKGEpLnN0eWxlLmRpc3BsYXkgPSBzaG93Ow0KICAgICAgICAgICAgICAgIC8vICAgICAgICAgICAgICAgIGlmKGMpew0KICAgICAgICAgICAgICAgIC8vICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCJnW2VkXFw6dG9ndG9waWNpZD0nIithKyInXSIpLnN0eWxlLmRpc3BsYXk9c2hvdzsNCiAgICAgICAgICAgICAgICAvLyAgICAgICAgICAgICAgICAgICAgaWYoYz09PSdtaW51cycpew0KICAgICAgICAgICAgICAgIC8vICAgICAgICAgICAgICAgICAgICAgICAgdXRkKGIsc2hvdykNCiAgICAgICAgICAgICAgICAvLyAgICAgICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgIC8vICAgICAgICAgICAgICAgICAgICBpZiAoYi5jYWxsJiZjPT09J3BsdXMnKSB7DQogICAgICAgICAgICAgICAgLy8gICAgICAgICAgICAgICAgICAgICAgICB1dGQoYixzaG93LHRydWUpDQogICAgICAgICAgICAgICAgLy8gICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICAvLyAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgLy8gICAgICAgICAgICAgICAgaWYoYi5jYWxsJiYhYykgew0KICAgICAgICAgICAgICAgIC8vICAgICAgICAgICAgICAgICAgICB1dGQoYixzaG93LHRydWUpDQogICAgICAgICAgICAgICAgLy8gICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgIGlmIChPYmplY3Qua2V5cyhiKS5sZW5ndGggIT09IDApIHsNCiAgICAgICAgICAgICAgICAgICAgdXRkKGIsIGEsIHNob3cpDQogICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgfQ0KICAgICAgICB9DQogICAgfQ0KICAgIGlmIChvYmouYm91bmRhcnkpIHsNCiAgICAgICAgdmFyIGJvdW5kYXJ5cyA9IE9iamVjdC5rZXlzKG9iai5ib3VuZGFyeSk7DQogICAgICAgIGlmIChjaGVja0lEICE9PSBvYmopIHsNCiAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgYm91bmRhcnlzLmxlbmd0aDsgaSsrKSB7DQogICAgICAgICAgICAgICAgdmFyIGEgPSBib3VuZGFyeXNbaV0uc2xpY2UoMSk7DQogICAgICAgICAgICAgICAgdmFyIGIgPSBvYmouYm91bmRhcnlbYm91bmRhcnlzW2ldXTsNCiAgICAgICAgICAgICAgICAvLyBjb25zb2xlLmxvZyhhKTsNCiAgICAgICAgICAgICAgICBkb2N1bWVudC5nZXRFbGVtZW50QnlJZChhKS5zdHlsZS5kaXNwbGF5ID0gc2hvdzsNCiAgICAgICAgICAgICAgICAvLyAgICAgICAgICAgICAgICBpZihjKXsNCiAgICAgICAgICAgICAgICAvLyAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQucXVlcnlTZWxlY3RvcigiZ1tlZFxcOnRvZ3RvcGljaWQ9JyIrYSsiJ10iKS5zdHlsZS5kaXNwbGF5PXNob3c7DQogICAgICAgICAgICAgICAgLy8gICAgICAgICAgICAgICAgICAgIGlmKGM9PT0nbWludXMnKXsNCiAgICAgICAgICAgICAgICAvLyAgICAgICAgICAgICAgICAgICAgICAgIHV0ZChiLHNob3cpDQogICAgICAgICAgICAgICAgLy8gICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICAvLyAgICAgICAgICAgICAgICAgICAgaWYgKGIuY2FsbCYmYz09PSdwbHVzJykgew0KICAgICAgICAgICAgICAgIC8vICAgICAgICAgICAgICAgICAgICAgICAgdXRkKGIsc2hvdyx0cnVlKQ0KICAgICAgICAgICAgICAgIC8vICAgICAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgLy8gICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgIC8vICAgICAgICAgICAgICAgIGlmKGIuY2FsbCYmIWMpIHsNCiAgICAgICAgICAgICAgICAvLyAgICAgICAgICAgICAgICAgICAgdXRkKGIsc2hvdyx0cnVlKQ0KICAgICAgICAgICAgICAgIC8vICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAoT2JqZWN0LmtleXMoYikubGVuZ3RoICE9PSAwKSB7DQogICAgICAgICAgICAgICAgICAgIHV0ZChiLCBhLCBzaG93KQ0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgIH0NCiAgICAgICAgfQ0KICAgIH0NCiAgICBpZiAoIW9jICYmIG9iai5jaGlsZCkgew0KICAgICAgICB2YXIgY2hpbGRzID0gT2JqZWN0LmtleXMob2JqLmNoaWxkKTsNCiAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaGlsZHMubGVuZ3RoOyBpKyspIHsNCiAgICAgICAgICAgIHZhciBhID0gY2hpbGRzW2ldLnNsaWNlKDEpOw0KICAgICAgICAgICAgdmFyIGIgPSBvYmouY2hpbGRbY2hpbGRzW2ldXTsNCiAgICAgICAgICAgIHZhciBjID0gYi50b2d0eXBlOw0KICAgICAgICAgICAgZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoYSkuc3R5bGUuZGlzcGxheSA9IHNob3c7DQogICAgICAgICAgICB2YXIgdFNQYXRoID0gZG9jdW1lbnQucXVlcnlTZWxlY3RvcigicGF0aFtlZFxcOnRvc3VwZXJpZD0nIiArIGEgKyAiJ10iKTsNCiAgICAgICAgICAgIGlmICh0U1BhdGgpIHsNCiAgICAgICAgICAgICAgICB0U1BhdGguc3R5bGUuZGlzcGxheSA9IHNob3c7DQogICAgICAgICAgICB9DQogICAgICAgICAgICB2YXIgbm90ZVRpcCA9IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoImdbZWRcXDpub3RldG89JyIgKyBhICsgIiddIik7DQogICAgICAgICAgICBpZiAobm90ZVRpcCkgew0KICAgICAgICAgICAgICAgIG5vdGVUaXAuc3R5bGUuZGlzcGxheSA9IHNob3c7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBpZiAoYi5yZWxhZnJvbSAmJiAhYykgew0KICAgICAgICAgICAgICAgIGlmIChiLnJlbGFmcm9tLmRpc3BsYXkgIT09IHNob3cpIHsNCiAgICAgICAgICAgICAgICAgICAgdmFyIHJlbGFmcm9tcyA9IE9iamVjdC5rZXlzKGIucmVsYWZyb20pOw0KICAgICAgICAgICAgICAgICAgICByZWxhZnJvbXMuc3BsaWNlKHJlbGFmcm9tcy5pbmRleE9mKCdkaXNwbGF5JyksIDEpOw0KICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBrID0gMDsgayA8IHJlbGFmcm9tcy5sZW5ndGg7IGsrKykgew0KICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSByZWxhZnJvbXNba107DQogICAgICAgICAgICAgICAgICAgICAgICBleHRyYVJlbGFbZF0uaXNDID0gdHJ1ZTsNCiAgICAgICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgICAgICBiLnJlbGFmcm9tLmRpc3BsYXkgPSBzaG93Ow0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgIH0NCiAgICAgICAgICAgIGlmIChiLnJlbGF0byAmJiAhYykgew0KICAgICAgICAgICAgICAgIGlmIChiLnJlbGF0by5kaXNwbGF5ICE9PSBzaG93KSB7DQogICAgICAgICAgICAgICAgICAgIHZhciByZWxhdG9zID0gT2JqZWN0LmtleXMoYi5yZWxhdG8pOw0KICAgICAgICAgICAgICAgICAgICByZWxhdG9zLnNwbGljZShyZWxhdG9zLmluZGV4T2YoJ2Rpc3BsYXknKSwgMSk7DQogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGsgPSAwOyBrIDwgcmVsYXRvcy5sZW5ndGg7IGsrKykgew0KICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSByZWxhdG9zW2tdOw0KICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmFSZWxhW2RdLmlzQyA9IHRydWU7DQogICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICAgICAgYi5yZWxhdG8uZGlzcGxheSA9IHNob3c7DQogICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgaWYgKGMpIHsNCiAgICAgICAgICAgICAgICBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCJnW2VkXFw6dG9ndG9waWNpZD0nIiArIGEgKyAiJ10iKS5zdHlsZS5kaXNwbGF5ID0gc2hvdzsNCiAgICAgICAgICAgICAgICBpZiAoYyA9PT0gJ21pbnVzJykgew0KICAgICAgICAgICAgICAgICAgICB1dGQoYiwgYSwgc2hvdykNCiAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgaWYgKChiLmNhbGwgfHwgYi5ib3VuZGFyeSB8fCBiLnN1bW1hcnkpICYmIGMgPT09ICdwbHVzJykgew0KICAgICAgICAgICAgICAgICAgICB1dGQoYiwgYSwgc2hvdywgdHJ1ZSkNCiAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICB9DQogICAgICAgICAgICBpZiAoYi5jYWxsICYmICFjKSB7DQogICAgICAgICAgICAgICAgdXRkKGIsIGEsIHNob3csIHRydWUpDQogICAgICAgICAgICB9DQogICAgICAgICAgICBpZiAoYi5zdW1tYXJ5ICYmICFjKSB7DQogICAgICAgICAgICAgICAgdXRkKGIsIGEsIHNob3cpDQogICAgICAgICAgICB9DQogICAgICAgICAgICBpZiAoYi5ib3VuZGFyeSAmJiAhYykgew0KICAgICAgICAgICAgICAgIHV0ZChiLCBhLCBzaG93KQ0KICAgICAgICAgICAgfQ0KICAgICAgICB9DQogICAgfQ0KfQ0KDQpmdW5jdGlvbiBleHRyYVJlbGFGaW4oKSB7DQogICAgdmFyIGV4dHJha2V5cyA9IE9iamVjdC5rZXlzKGV4dHJhUmVsYSk7DQogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBleHRyYWtleXMubGVuZ3RoOyBpKyspIHsNCiAgICAgICAgdmFyIGV4dHJhT2JqID0gZXh0cmFSZWxhW2V4dHJha2V5c1tpXV07DQogICAgICAgIGlmIChleHRyYU9iai5pc0MgPT09IHRydWUpIHsNCiAgICAgICAgICAgIHZhciBmc2hvdyA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKGV4dHJhT2JqLmZyb21pZCkuc3R5bGUuZGlzcGxheSAhPT0gJ25vbmUnID8gdHJ1ZSA6IGZhbHNlOw0KICAgICAgICAgICAgdmFyIHRzaG93ID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoZXh0cmFPYmoudG9pZCkuc3R5bGUuZGlzcGxheSAhPT0gJ25vbmUnID8gdHJ1ZSA6IGZhbHNlOw0KICAgICAgICAgICAgZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoZXh0cmFPYmouaWQpLnN0eWxlLmRpc3BsYXkgPSBmc2hvdyAmJiB0c2hvdyA/ICdibG9jaycgOiAnbm9uZSc7DQogICAgICAgICAgICBleHRyYVJlbGFbZXh0cmFrZXlzW2ldXS5pc0MgPSBmYWxzZTsNCiAgICAgICAgfQ0KICAgIH0NCn0='))</script>
  </body>
</html>
